<?php
require_once "checklogin.php";
require_once "../lib/MySQLDB.class.php";
$db=MySQLDB::getInstance();
if(!empty($_POST)){
    $data=$_POST;
    $sql="insert into admininfo (userID,userName,userPwd,userRoleID) values (?,?,?,?) ";
    $res=$db->query($sql,'sssi',$data);
    if($res){
        layerAlert("管理员添加成功！",1,"adminList.php");
    }else{
        layerAlert("管理员添加失败！",5,"adminList.php");
    }
}else{
    $sql="select * from admininfo order by userID asc";
    $rows=$db->fetchAll($sql);
    require_once "view/adminAdd.html";
}